package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     * 根据套餐id查询套餐和菜品的关联关系
     * @param id
     * @return
     */

    @Select("select * from setmeal_dish where setmeal_id = #{id}")
    List<SetmealDish>  getBySetmealId(Long id);

    /**
     * 根据菜品id查询关联的套餐id
     * @param Ids
     * @return
     */
    List<Long> getSetmealIdsByDishIds(@Param("ids") List<Long> Ids);

    void insertBatch(List<SetmealDish> setmealDish);

    @Delete("delete from setmeal_dish where id = #{setmealId}")
    void deleteBySetmealId(@Param("setmealId") Long setmealId);
}

